//
//  SEGEditJobAndMaleTableViewCell.m
//  ExcellentHome
//
//  Created by 梁昆 on 2017/11/1.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGEditJobAndMaleTableViewCell.h"

@implementation SEGEditJobAndMaleTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier
{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    switch (_editType) {
        case EditJobAndMaleType_Male: {
            [self ConstraintsUI_Male];
        } break;
        case EditJobAndMaleType_Job: {
            [self ConstraintsUI_Job];
        } break;
            
        default:
            break;
    }
}

-(void)ConstraintsUI_Male{
    [self.contentView addSubview:self.normalLabel];
    [self.normalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).mas_offset(15);
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.contentView addSubview:self.nodeLabel];
    [self.nodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).mas_offset(45);
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.contentView addSubview:self.selectImage];
    [self.selectImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.centerY.equalTo(self.contentView);
    }];
}

-(void)ConstraintsUI_Job{
//    [self.contentView addSubview:self.normalLabel];
//    [self.normalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.contentView).mas_offset(45);
//        make.centerY.equalTo(self.contentView);
//    }];

    [self.contentView addSubview:self.nodeLabel];
    [self.nodeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).mas_offset(45);
        make.centerY.equalTo(self.contentView);
    }];
    
    [self.contentView addSubview:self.selectImage];
    [self.selectImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.centerY.equalTo(self.contentView);
    }];
    

//    [self.contentView addSubview:self.upImage];
//    [self.upImage mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self.contentView).mas_offset(-15);
//        make.centerY.equalTo(self.contentView);
//    }];
//
//    [self.contentView addSubview:self.downImage];
//    [self.upImage mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self.contentView).mas_offset(-15);
//        make.centerY.equalTo(self.contentView);
//    }];
}

#pragma mark - getter
-(UILabel *)normalLabel{
    if (!_normalLabel) {
        _normalLabel = [[UILabel alloc] init];
        [_normalLabel setFont:[UIFont systemFontOfSize:15]];
        [_normalLabel setTextColor:kColor_1];
    }
    return _normalLabel;
}

-(UILabel *)nodeLabel{
    if (!_nodeLabel) {
        _nodeLabel = [[UILabel alloc] init];
        [_nodeLabel setFont:[UIFont systemFontOfSize:16]];
        [_nodeLabel setTextColor:kColor_1];
    }
    return _nodeLabel;
}

-(UIImageView *)selectImage{
    if (!_selectImage) {
        _selectImage = [[UIImageView alloc] init];
        _selectImage.image = [UIImage imageWithContentsOfFile:SEGPicName(@"icon_list_select")];
        _selectImage.hidden = YES;
    }
    return _selectImage;
}

-(UIImageView *)upImage{
    if (!_upImage) {
        _upImage = [[UIImageView alloc] init];
        _upImage.image = [UIImage imageWithContentsOfFile:SEGPicName(@"btn_list_down")];
    }
    return _upImage;
}

-(UIImageView *)downImage{
    if (!_downImage) {
        _downImage = [[UIImageView alloc] init];
        _downImage.image = [UIImage imageWithContentsOfFile:SEGPicName(@"btn_list_up")];
    }
    return _downImage;
}
@end
